﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

#if WINDOWS_PHONE
#else

#endif // WINDOWS_PHONE

using System.IO.IsolatedStorage;
using System.IO;

namespace DARE
{
    public interface IStorage
    {

        #region Property

        bool IsSynchronize { get; }

        long TotalSpace { get; }

        long FreeSpace { get; }

        #endregion

        #region Event

        event Action<IStorage> StorageReady;
        event Action<IStorage> StorageFailed;

        #endregion

        #region Method

        #endregion
        // Summary:
        //     Creates a new directory in the StorageContainer scope.
        //
        // Parameters:
        //   directory:
        //     The relative path of the directory to delete within the StorageContainer
        //     scope.
        void CreateDirectory(string directory);

        //
        // Summary:
        //     Creates a file at a specified path in the StorageContainer.
        //
        // Parameters:
        //   file:
        //     The relative path of the file to be created in the StorageContainer.
        Stream CreateFile(string file);

        //
        // Summary:
        //     Deletes a directory in the StorageContainer scope.
        //
        // Parameters:
        //   directory:
        //     The relative path of the directory to delete within the StorageContainer
        //     scope.
        void DeleteDirectory(string directory);

        //
        // Summary:
        //     Deletes a file in the StorageContainer.
        //
        // Parameters:
        //   file:
        //     The relative path of the file to delete within the StorageContainer.
        void DeleteFile(string file);

        //
        // Summary:
        //     Determines whether the specified path refers to an existing directory in
        //     the StorageContainer.
        //
        // Parameters:
        //   directory:
        //     The path to test.
        bool DirectoryExists(string directory);

        //
        // Summary:
        //     Immediately releases the unmanaged resources used by this object.
        void Dispose();

        //
        // Summary:
        //     Determines whether the specified path refers to an existing file in the StorageContainer.
        //
        // Parameters:
        //   file:
        //     The path and file name to test.
        bool FileExists(string file);

        //
        // Summary:
        //     Enumerates the directories in the root of a StorageContainer.
        string[] GetDirectoryNames();

        //
        // Summary:
        //     Enumerates the directories in the root of a StorageContainer that conform
        //     to a search pattern.
        //
        // Parameters:
        //   searchPattern:
        //     A search pattern. Both single-character ("?") and multicharacter ("*") wildcards
        //     are supported.
        string[] GetDirectoryNames(string searchPattern);

        //
        // Summary:
        //     Enumerates files in the root directory of a StorageContainer.
        string[] GetFileNames();

        //
        // Summary:
        //     Enumerates files in the root directory of a StorageContainer that match a
        //     given pattern.
        //
        // Parameters:
        //   searchPattern:
        //     A search pattern. Both single-character ("?") and multicharacter ("*") wildcards
        //     are supported.
        string[] GetFileNames(string searchPattern);

        //
        // Summary:
        //     Opens a file in the StorageContainer.
        //
        // Parameters:
        //   file:
        //     Relative path of the file within the StorageContainer.
        //
        //   fileMode:
        //     One of the enumeration values that specifies how to open the file.
        Stream OpenFile(string file, FileMode fileMode);

        //
        // Summary:
        //     Opens a file in the StorageContainer in the designated mode with the specified
        //     read/write access.
        //
        // Parameters:
        //   file:
        //     Relative path of the file within the StorageContainer.
        //
        //   fileMode:
        //     One of the enumeration values that specifies how to open the file.
        //
        //   fileAccess:
        //     One of the enumeration values that specifies whether the file is opened with
        //     read, write, or read/write access.
        Stream OpenFile(string file, FileMode fileMode, FileAccess fileAccess);

        //
        // Summary:
        //     Opens a file in the StorageContainer in the designated mode with the specified
        //     read/write access and sharing permission.
        //
        // Parameters:
        //   file:
        //     Relative path of the file within the StorageContainer.
        //
        //   fileMode:
        //     One of the enumeration values that specifies how to open the file.
        //
        //   fileAccess:
        //     One of the enumeration values that specifies whether the file is opened with
        //     read, write, or read/write access.
        //
        //   fileShare:
        //     A bitwise combination of enumeration values that specify the type of access
        //     other Stream objects have to this file.
        Stream OpenFile(string file, FileMode fileMode, FileAccess fileAccess, FileShare fileShare);

        void Synchronize();
    }
}
